/*
###############################################################################################
#                                                                                             # 
# Login Page for admin user                                                                   #
# The data will be used from the 'tbl_Admin' table                                            #
#     Author : Sharvan Kumar                                                                  #
#     Dated  : 16-Feb-2006                                                                    #
#                                                                                             #
###############################################################################################
*/



using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using SiteManager;

public partial class Admin_Adlogin : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Page.IsPostBack)
        {
            // Creating instense of WebDesignManager Class
            Manager manager = new Manager(true,"ConnectionString");
            // Authenticating User
            manager.Authenticate(UserName.Text, Password.Text);
            if (Session["ADMIN_ID"] != null && Session["ADMIN_ID"].ToString().Trim().Length != 0)
            {
                if (Session["Password"].ToString() == Password.Text)//v
                {//v


                    // if User check wether we are comming from some other page or directly reached on this page
                    if (Request.QueryString.HasKeys() && Request.QueryString["pg"] != null && Request.QueryString["pg"].Trim().ToString().Length != 0)
                    {
                        // If from some other page.. redierct to same page
                        Response.Redirect(Request.QueryString["pg"].Trim().ToString());
                    }
                    else
                    {
                        // if direct.. redirect to Main Menu
                        Response.Redirect("ADadminAccess.aspx");
                    }

                }//v
                else//v
                {//v
                    lblMsg.Visible = true;
                    Session["ADMIN_ID"] = "";
                    lblMsg.Text = "Invalid Password or Check Case";

                }//v



            }
            else
            {
                // Display error if login fails
                lblMsg.Visible = true;
            }

        }

    }

    protected void Button1_Click(object sender, EventArgs e)
    {

    }
}
